﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
namespace XYZshell.Game.CardGameEngine
{
	/// <summary>
	/// 条件表达式参数
	/// </summary>
	[Serializable]
	[XmlRoot("param")]
	public  class ExpressionParam:IXMLable
	{
		/// <summary>
		/// 参数名称
		/// </summary>
		[XmlAttribute("name")]
		public string Name
		{
			get;
			set;
		}
		/// <summary>
		/// 参数的值
		/// </summary>
		[XmlAttribute("value")]
		public string Value
		{
			get;
			set;
		}
		/// <summary>
		/// 参数值的类型
		/// </summary>
		[XmlAttribute("type")]
		public ExpressionParamType ValueType
		{
			get;
			set;
		}

		/// <summary>
		/// 转换为参数值的运行时类型
		/// </summary>
		[XmlIgnore]
		public Type TypeValue
		{
			get;
			set;
		}

		#region IXMLable 成员

		/// <summary>
		/// 转换为XML
		/// </summary>
		/// <returns></returns>
		public string ToXML()
		{
			return string.Format( "<param name=\"{0}\" value=\"{1}\" type=\"{2}\"/>", Name, Value, this.ValueType.ToString().ToLower() );
		}

		/// <summary>
		/// 从XML中生成条件表达式参数
		/// </summary>
		/// <param name="xmlNode"></param>
		/// <returns></returns>
		public GameObject FromXML( string xmlNode )
		{
			throw new NotImplementedException();
		}

		#endregion
	}
}
